Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix task instance limit #97011

Merged
merged 1 commit into from May 5, 2020
Merged

Fix task instance limit #97011

merged 1 commit into from May 5, 2020

Conversation

alexr00
Copy link
Member

@alexr00 alexr00 commented May 5, 2020

Fixes #96999

@alexr00 alexr00 self-assigned this May 5, 2020
@alexr00 alexr00 added this to the April 2020 milestone May 5, 2020
@alexr00
Copy link
Member Author

alexr00 commented May 5, 2020

A few months ago we added an instanceLimit to tasks. This allows the same task to be run multiple times at once and each task keeps track of which instance it is. The new task quick pick work from last month causes the tasks system to re-use the same task objects instead of re-creating all of them every time. This is a problem because now when a task's instance is set it's actually setting the instance of the previous task of the same ID that was run. The solution is to simply make a copy of the task before running it.

@@ -229,6 +229,7 @@ export class TerminalTaskSystem implements ITaskSystem {
}

public run(task: Task, resolver: ITaskResolver, trigger: string = Triggers.command): ITaskExecuteResult {
task = task.clone(); // A small amount of task state is stored in the task (instance) and tasks passed in to run may have that set already.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it only do this conditionally if instanceLimit > 1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix this bug, yes it only needs to be done if instanceLimit >= 1. However, it would be better to not pollute the original tasks state regardless so I will keep it always cloning.

@alexr00 alexr00 merged commit 96b89dd into release/1.45 May 5, 2020
@alexr00 alexr00 deleted the alexr00/issue96999 branch May 5, 2020 16:10
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants